//index.js
//获取应用实例
const app = getApp()
const Api = require("../../utils/api.js").API
// const Store = require("../../utils/store.js").store
const codeZ = require("../../utils/util.js")
Page({
    data: {
        hei2:500,
        showXin:false,
        page: 0,
        ckName: '',
        limit: 10,
        ckList: []
    },
    onShow(){
        this.setData({
            
             hei2:app.globalData.screenHeight-60,
             
        })
        this.initParam()
        this.getList()
    },
    dail: function(e){
        let phone = e.currentTarget.dataset.phone
        wx.makePhoneCall({
            phoneNumber: phone
        })
    },
    onSureSearch: function() {
        this.initParam()
        this.getList()
    },
    onSerach: function(e) {
        // console.log(e.detail)
        this.setData({
            ckName: e.detail
        }) 
    },
    getList: function() {
        let _this = this
        Api.ckListApi({
            page: this.data.page,
            limit: this.data.limit,
            ckName: this.data.ckName
        }).then(res=>{
            if (res.code == 0) {
            //    console.log(res)
               _this.setData({
                   ckList: res.page.records
               })
            }
            
        });
    },
    initParam: function() {
        this.setData({
            page: 0,
            limit: 10
        })
    },
    refreshBottom: function() {
        let _this = this
        let page = _this.data.page
        this.setData({
            page: page++
        })
        this.getList()
    },
    backHome:function(){
        wx.switchTab({
            url:'../index/index'
        })
    },
    backMy:function(){
        wx.navigateBack();
    },
   
    
    onClose:function(){
        this.setData({
           
            showXin:false,
        })
    },
    jump:function(){
        this.setData({
            showXin:true,
        })
    }
  
  

  







});
